DOC.TXT DME V1.21 (c)CopyRight 1987, Matthew Dillon. All Rights Reserved. This software may be freely distributed only in the following forms: (1) this document plus the source (2) this document plus the executable (3) this document plus the source plus the executable Matthew Dillon 891 Regal Rd Berkeley, Ca. 94708 USENET ihnp4!ucbvax!dillon ARPANET dillon@ucbvax.berkeley.edu --------------------------------------------------------------------------- I Overview II Keymapping keymapping III Command Sequences DME commands IV File Particulars notes on loading and saving files V Revision Summary revision numbering VI Compiling compiling instructions I OVERVIEW DME is a (simple?) WYSIWYG editor designed for programmers (i.e. it is not a word processor). I consider the following aspects of DME 'features': -control language based on a rich command set accessed manually or via arbitrary mapping of keys. (Every key may be mapped to 8 different things) -fast visual response (it scrolls quickly) -title-line statistics showing your current position in the file, file name, whether the file has been modified or not, etc... -(new for V1.21) Multiple Windows, ability to iconify windows DME has been designed to allow easy expansion, and I intend to make many future improvments. It has not been designed for user friendliness, but is straight forward if you read this document fully. DME optionaly takes a single argument which is the file to edit. Additionaly, DME will SOURCE (see section III) C:.EDRC, and the .EDRC in the current directory on startup, allowing for both a generarlized and a specialized initialization file. The files contain DME commands (usually keymappings, but can be anything). Both C:.EDRC and .EDRC are sourced after the (optional) file is loaded. II KEYMAPPING MOUSE SELECT (LEFT ) BUTTON: There is no designation to map the left button. positions cursor at the indicated spot. The cursor now tracks the mouse. MOUSE MENU (RIGHT) BUTTON: There is no designation to map the right button. This button iconifies the current active window if not iconified, and de-iconifies the window if iconified (Try IT!). The iconification features: -Remembers original window size and placement -Remembers placement of iconified window when you re-iconify later. Currently, you will crash the machine if you run out of memory and DME is unable to open the icon window or original window, so be careful. KEYBOARD: The rest of the Functional interface for DME is based on keymappings and a rich command set. Unlike other text editors, any non-qualifier key in DME may have any meaning whatsoever. It just so happens that the default keymappings assign such things as the `return' key to the RETURN function, the `up' key to the UP function, etc... Keys are named by their keycap labels with the following exceptions: the name for Back-Space is BS the name for numeric keypad keys are prepended with an NK, except for the Enter key which is named 'ENTER'. The four cursor control keys are labeled UP, DOWN, LEFT, and RIGHT *NOTE* You must type commands in lower-case, except for text, which can be either lower or upper case, and for upper-case alpha keys when specifying keymaps (i.e. A and s-a are the same key). Each key may be qualified with any combination of CTRL, ALT, or SHIFT keys. With three qualifier keys, you can assign up to 8 different meanings per physical (non qualifier) key on the keyboard. NOTE that the CAPS-LOCK, when lit, only effects Alpha Keys. ***EXAMPLES:*** tab tab s-tab SHIFT tab c-tab CTRL tab ac-? ALT-CTRL ? s-f5 SHIFT F5 nk0 Numeric Keypad 0 cs-nk0 CTRL SHIFT Numeric Keypad 0 *************** The Default Mappings are as follows: All Printable Ascii keys mapped to their ascii equivalent BS, DEL, UP, DOWN, LEFT, RIGHT, TAB, S-TAB, ENTER mapped properly return Mapped to a sequence which also inserts a new line and autoindents the cursor. Not to be confused with the RETURN command. esc Toggle Command Line Entry (CLE?) mode. s-up Top of Text s-left Column 0 s-down Botton of Text s-right Last Column in line `s- ' shift space mapped to space c-up Page up c-down Page down s-del Delete Line c-del Remove to End Of Line c-l previous word c-r next word c-i Insert Mode c-o Overstrike Mode c-j Join line c-s Split line c-n Find Next c-p Find Prev c-/ (Prompts for Find string) c-b Start-End block c-u Unblock (reset block markers to NULL) a-c Copy block (insert before current line) a-d Delete Block a-m Move Block (insert before current line) a-s Source Block (bsource) a-S Source current line (unblock block block bsource) this command makes life easy when designing keymaps. (Remember: a-S equivalent to sa-s) f1 (Prompts for file to insert) f2 (Prompts for new file to load.. replaces previous text) f3 (Prompts for file to load into a new window) f7 Save block (Prompts for filename) f8 Save & open new file (Pompts for filename after save) f9 Save (do not quit) f10 Save and Quit To see how these keys are bound, use the SAVESMAP command. III COMMAND SEQUENCES DME has a rich command set which allows you to embed commands within commands, or specify multiple commands in a row. A command consists of a KEYWORD followed by a FIXED number of arguments (0, 1, 2...). The argument delimeter in DME is a SPACE. Therefore, to embed strings containing spaces as a single argument, you must surround the string with `string' (backquote-string-quote). TEXT to be written as if typed is also specified via a string in backquote-quotes. For example: right right `hello' right right `hello' enter down map f4 `right right' map f5 `left left' map f4 ``hello'' Reiterating (because this is important!)... If a command expects ONE argument, then it really does expect a single argument, and any remaining arguments are thought to be the next command... so: map f4 right -right is only one word, so no need for `'. map f4 `right right' -we want to map f4 to two rights... we need the `' or the second right will not be part of the map. map c-del `repeat cright del' -this is already implimented as REMEOL, but shown here for clarity. Some arguments will eventually be fed through the command interpreter more than once. The MAP command is a good example. When you execute a MAP command, the first run through the command interpreter installs the map string minus a set of quotes. So, if you want to specify text, you must enclose the text in two sets of ``text'' because the map string gets passed through the command interpreter again when you hit the mapped key. Here are some more complex examples: map f4 `right right `hello' left left' *RIGHT* map f4 right right hello left left *WRONG* map f4 `map f4 ``hello''' -the first time you hit F4, it's command is to re-map itself to the TEXT `hello'. (gads!). map c-i `repeat tr `` ''' -example of how to embed a space in a map and repeat (goes through command interpreter three times!). An easy way to fool around executing commands or making maps is either to use the ESC key (which enters command mode), or a-S (alt-shift-s), which EXECUTES the current DME line that the cursor is on.... so you can use DME to edit and test your new keymappings. !!!!!!!!!! NOTE NOTE NOTE NOTE NOTE !!!!!!!!!!!!!! You must type commands in LOWER case. They are in upper case here for visibility. COMMAND LIST `text' -enter text as if typed. BS -Back Space: Remove char to left of cursor and move rest of line back one. BACK -same as BS BACKTAB -Cursor left to previous tab stop (see TABSTOP) BCOPY -Insert specified block infront of current cursor line BDELETE -Delete specified block BLOCK -Specify the Start or End of a block (blocks are not currently highlighted) BMOVE -Move specified block, inserting it before the current line. BOTTOM -Move cursor to the BOTTOM OF TEXT BSAVE arg -Save specified block to a file BSOURCE -Source specified block (you can use DME to construct commands) DEL -Delete Char: Remove char under cursor and move rest of line back one. DELINE -Delete the Current line DOWN -cursor down. NOP if at end of text DOWNADD -Cursor down and add a blank line if at end of text ESC -ESC into Command Mode ESCIMM arg -ESC into Command Mode prompting with `arg' (see SAVESMAP to get a good example file) FIND arg -Search for the given string. Case sensitive FINDR arg arg -As in FIND, but replace with second argument FINDSTR arg -SET the search string (NO search operation performed) FIRST -Move Cursor To Column 0 FIRSTNB -Move cursor to first non-blank character in line GOTO arg -Goto the specified line number GOTO [+/-]arg -Goto relative current line number. +/- N e.g. GOTO -2 would jump up two lines. IF cond t -If condition do operation (SEE BELOW) IFELSE cond t f -If condition do op. else do another op (SEE BELOW) INSERTMODE arg -where arg is ON, OFF, or TOGGLE e.g. `insertmode toggle' toggles the current insert mode. INSFILE arg -insert a file into the current text INSLINE -Insert a line before the current line JOIN -Join next line to this line (does not move the cursor) LAST -Move Cursor To Last Column (spaces below and beyond) LEFT -cursor left MAP key arg -Map a key to an argument. NOTE: argument will eventually be passed through command interpreter twice. NEWFILE arg -load a new file, replacing the old text. If current file is modified, you get a requester. NEWWINDOW -open new window and make it the current window (see the F3 keymap). Currently, you cannot do block copy's across windows (sorry). Use BSAVE to save a block to a temporary file. NEXT -Search for the next occurance of the string (see FIND, FINDSTR) NEXTR -Search for next occurance and replace (see FINDR, REPSTR) PAGEUP -Page Up a Page PAGEDOWN -Page Down a Page PREV -Search for the previous occurance of the string (see FIND, FINDSTR) PREVR -Search for the previous occurance and replace (see FINDR, REPSTR) REPSTR arg -SET the replace string (NO operation is performed) QUIT -Quit current window without saving. When the last window is closed, the editor exists. If the text has been modified, put up a requester. RETURN -as in CR-LF. RETURN does NOT insert a line, though it will add lines if at the end of text. REMEOL -Delete to End Of Line. REPEAT N arg (SEE BELOW) RIGHT -cursor right SAVEOLD -save current text as the name specified in the title line (NOTE: Takes NO argument!) SAVEAS arg -save current text as the given name SAVEMAP arg -save user keymappings to a sourceable typeable file SAVESMAP arg -save user+system keymappings to a sourceable typeable file (usefull for beginners) SCREENTOP -Home to upper left hand corner of the window SCREENBOTTOM -To lower left hand corner of the window SOURCE arg -Execute DME Commands from a file SPLIT -Split line at cursor (does not move the cursor) TAB -Cursor right to next tab stop TABSTOP arg -Set Tab stops (does not effect file load/save tabstops) TOP -Move cursor to the TOP OF TEXT TLATE [+/-]# -relative translation of char under cursor by # (ascii code) TLATE # -set character under cursor to exactly # (0 is illegal) tlate +1 -increment character under cursor tlate 65 -sets to uppercase A UNBLOCK -Reset block markers to nothing UNMAP key -Unmap a key UP -cursor up WHILE cond t -While condition, do operation (SEE BELOW) WLEFT -go to beginning of current word (previous word if at beginning of current word) WRIGHT -go to beginning of next word ------------------------------------------------------------------- Command which cause a command line to abort (e.g. in repeat, while): FIND[R]/NEXT[R]/PREV[R] when the string is not found. NEXT stops at the end of the file, PREV stops at the beginning. DOWN,LEFT,RIGHT,UP when the operation cannot be done. ------------------------------------------------------------------- REPEAT N arg -Repeat `arg' N times. Apart from being a number, N can also be one of: line Current line # (lines begin at 1) lbot #lines to the bottom, including current line cleft column # (cols begin at 0) cright #chars to eol, including current char under cursor tr #char positions to next tab tl #char positions to next back tab Certain commands can abort a REPEAT loop. Specifically, any FIND[R], NEXT[R], or PREV[R] in which the search string is NOT found will abort a REPEAT. Specifying -1 as N causes REPEAT to go on forever (well, actually, 0xFFFFFFFF times). IF condition arg WHILE condition arg IFELSE condition arg elsearg If the specified condition is true, execute the argument. For WHILE, the argument is executed until the condition is false (be careful!). Conditions: # if toggle entry # is SET t if On line 1 b if On last line l if At column 0 r if At end of line (spaces below and beyond) m if Text has been modified i if in insert mode cl character under cursor is lower case alpha cu character under cursor is upper case alpha ca character under cursor is alpha-numeric cn character under cursor is numeric c# character under cursor is ascii code # (# in decimal) Example: simulating an insert mode toggle: ALT-i (not CTL-i) map a-i `ifelse 0 `toggle 0 insertmode OFF' `toggle 0 insertmode ON'' Example: while lower case, map to upper case and move right. map c-U `while cl `tlate -32 right'' WARNING: It is possible to get into infinite loops with REPEAT and WHILE. Currently, BREAK is *not* handled by the open window, but by whatever executed DME. That is, you must either Ctl-C from your CLI, or send a BREAK to the DME process. I hope to fix this soon. IV FILE PARTICULARS No Matter what you set internal tabs to, tabs in disk files will be 8. However, in the current implimentation, DME writes out spaces instead of tabs anyway. The command to save the current document under the default name is SAVEOLD, *not* SAVE. SAVE is not a valid command. This is to prevent people who have not read the documentation from assuming 'save' takes an argument (and screwing up their work). SAVEOLD does NOT take an argument, SAVEAS does. V REVISION SUMMARY V1.21 RELEASE (BUG FIXES FROM 1.20) -iconify and window handling fixed -left mouse button now tracks the mouse. V1.20 RELEASE -bug fixes: bsave now unmarks the block, bdelete now sets 'modified' flag. (other small fixes). -enhancements: overwrite mode status indicator, find, find-replace now completely implemented (yahhoo!!!) -changed commands: FIND NEXT PREV: no longer loop back to the top of file or top->bottom in the case of PREV. DELINE will now delete text on the line if there is only one line of text. -enhanced commands: GOTO REPEAT -new commands: SAVEMAP SAVESMAP TOGGLE SETTOGGLE RESETTOGGLE TLATE IF IFELSE WHILE BSOURCE FINDSTR REPSTR FINDR NEXTR PREVR NEWWINDOW -new keymappings: (see a-s, a-S, f3) -window iconification with mouse menu button. V1.12 RELEASE -cursor is now pen #3 rather than #1. -changeover to AZTEC C, smaller executable. -now maps shift space to a space. -new commands: REMEOL, WLEFT, WRIGHT -display bug fixes (SPLIT) -FIND/PREV/NEXT will now abort a REPEAT if string not found. V1.11 RELEASE NOTES -Bug fixes (mainly graphical mistakes). -User keymappings are disabled in command mode (so you can unmap single ascii characters you may have mapped). -Illegal key combinations no longer give garbage (e.g. ALT-CURSOR-DOWN) you can, of course, still map them to anything you wish. -Save now checks for error conditions on write. -Uses Default Console Keymap (i.e. no longer assumes USA)... but there *is* some stangeness. V1.00 RELEASE NOTES -has find, but no replace function -marked blocks are not highlighted -assumes USA keyboard (fixed 1.11) -disk files written out use spaces instead of tabs&spaces -No scroll bar yet. VI COMPILING DME now compiles under AZTEC. You must compile with the 32 bit int option, but may use the small code/data model. You must use V3.00 or above of MY.LIB (MY32.LIB), dated MARCH 1987 cc +L -S NAME.c (for each .C module) ln *.o -lmy32 -lcl32 +Q To compile DME under lattice requires the MY.LIB version 3.00 or above: lc1 -oram: -iinclude: NAME.C lc2 -s -v -oNAME.o ram:NAME.q blink lattice:Astartup.obj library lib:my.lib+lib:amiga.lib to ram:dme ND